% Compute four clusters of the Fisher iris data using Ward linkage
% and ignoring species information, and see how the cluster
% assignments correspond to the three species.
load fisheriris;
Z = linkage(meas,'ward','euclidean');
% c = cluster(Z,'maxclust',4);
% crosstab(c,species);
dendrogram(Z);

% Create a hierarchical cluster tree for a data with 20000
% observations using Ward linkage. If you set the value of
% 'savememory' to 'off', you may get an out-of-memory error if your
% machine doesn't have enough memory to hold the distance matrix.
X = rand(20000,3);
Z = linkage(X,'ward','euclidean','savememory', 'on');